package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class UserInfo extends MenuList {
    String menuName = "My Info";

    public boolean execute() throws IOException {
        File logFile = new File("src/com/twu/biblioteca/current.txt");
        BufferedReader fileReader = new BufferedReader(new FileReader(logFile));
        String dataLine;

        while((dataLine = fileReader.readLine())!=null) {
            String[] userInfo = dataLine.split(" ");
            System.out.println( "User Info\n" +
                                "Member ID: "+userInfo[0]+"\n"+
                                "Name: "+userInfo[2]+"\n"+
                                "Mail ID: "+userInfo[3]
                                );
            return true;
        }

        return false;
    }
    public String getMenuName() {
        return menuName;
    }
}
